package com.wems.farm_manage.service.impl;

import java.util.List;
import com.wems.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wems.farm_manage.mapper.EquipmentTypeMapper;
import com.wems.farm_manage.domain.EquipmentType;
import com.wems.farm_manage.service.IEquipmentTypeService;

/**
 * 设备类型Service业务层处理
 * 
 * @author MPC
 * @date 2025-04-05
 */
@Service
public class EquipmentTypeServiceImpl implements IEquipmentTypeService 
{
    @Autowired
    private EquipmentTypeMapper equipmentTypeMapper;

    /**
     * 查询设备类型
     * 
     * @param typeId 设备类型主键
     * @return 设备类型
     */
    @Override
    public EquipmentType selectEquipmentTypeByTypeId(Long typeId)
    {
        return equipmentTypeMapper.selectEquipmentTypeByTypeId(typeId);
    }

    /**
     * 查询设备类型列表
     * 
     * @param equipmentType 设备类型
     * @return 设备类型
     */
    @Override
    public List<EquipmentType> selectEquipmentTypeList(EquipmentType equipmentType)
    {
        return equipmentTypeMapper.selectEquipmentTypeList(equipmentType);
    }

    /**
     * 新增设备类型
     * 
     * @param equipmentType 设备类型
     * @return 结果
     */
    @Override
    public int insertEquipmentType(EquipmentType equipmentType)
    {
        equipmentType.setCreateTime(DateUtils.getNowDate());
        return equipmentTypeMapper.insertEquipmentType(equipmentType);
    }

    /**
     * 修改设备类型
     * 
     * @param equipmentType 设备类型
     * @return 结果
     */
    @Override
    public int updateEquipmentType(EquipmentType equipmentType)
    {
        equipmentType.setUpdateTime(DateUtils.getNowDate());
        return equipmentTypeMapper.updateEquipmentType(equipmentType);
    }

    /**
     * 批量删除设备类型
     * 
     * @param typeIds 需要删除的设备类型主键
     * @return 结果
     */
    @Override
    public int deleteEquipmentTypeByTypeIds(Long[] typeIds)
    {
        return equipmentTypeMapper.deleteEquipmentTypeByTypeIds(typeIds);
    }

    /**
     * 删除设备类型信息
     * 
     * @param typeId 设备类型主键
     * @return 结果
     */
    @Override
    public int deleteEquipmentTypeByTypeId(Long typeId)
    {
        return equipmentTypeMapper.deleteEquipmentTypeByTypeId(typeId);
    }
}
